#include <bits/stdc++.h>
using namespace std;
const int N = 30;

int n, m;
vector<int> path;

void dfs(int k)
{
	if(path.size() == m)
	{
		for(auto &e : path) cout << e << " ";
		cout << endl;
		return;
	}
	for(int i = k;i <= n;i ++)
	{
		path.push_back(i);
		dfs(i + 1);
		path.pop_back();
	}
}

int main()
{
	cin >> n >> m;
	dfs(1);
	return 0;
}